<template>
   <div class="son">
     <h2>孙组件GrandSon----->{{msg}}</h2>
     <Dialog></Dialog>
   </div>
</template>

<script>
import Dialog from './Dialog.vue'
import {inject,toRefs} from 'vue'
export default {
    components:{
        Dialog
    },
    setup(){
       const state=inject('msg')
       return{
           ...toRefs(state) 
       }
    }
}
</script>

<style>
    .son{
        padding: 20px;
        background: skyblue;
    }
</style>